package com.swsc.xapp.utils;

import android.widget.Toast;

public class ToastUtils {
    private static final Object lock = new Object();
    private static final Object showLock = new Object();

    private static Toast toast;

    public static android.widget.Toast getToast(){
        if (toast == null) {
            synchronized (lock) {
                if (toast == null) {
                    toast = android.widget.Toast.makeText(ContextUtils.getCurApplication(), "", android.widget.Toast.LENGTH_SHORT);
                }
            }
        }
        return toast;
    }
    private ToastUtils(){
    }
    public static void subThreadMakeText(String text){
        synchronized (showLock){
            getToast().setText(text);
            getToast().show();
        }
    }
}
